import requests


def bengdata():
    url ="http://222.134.245.144:17000//chuanganqi/FieldConfigModel/"
    response = requests.get(url)
    if response.status_code == 200:
        data = response.json()
        results = data.get("results", [])
        if results and isinstance(results, list):
            pump_names = []  # 用于存储标准化的泵名称
            for result in results:
                zhufubeng_data = result.get("zhufubeng", [])
                for pump_info in zhufubeng_data:
                    pump_type = pump_info["pump"]
                    pump_name = pump_info["name"]
                    # 统一键格式，去除多余描述，使用"泵名称-类型"格式
                    if pump_type == "主泵":
                        pump_names.append(f"{pump_name}-主泵")
                    elif pump_type == "副泵":
                        pump_names.append(f"{pump_name}-副泵")
            if len(pump_names) >= 2:
                print(pump_names[0], pump_names[1])   # 返回标准化的两个泵名称
            else:
                return "未知主泵", "未知副泵"  # 处理数据不足的情况
        else:
            print("未找到有效的 zhufubeng 数据")
            return "未定义主泵", "未定义副泵"
    else:
        print(f"请求失败，状态码: {response.status_code}")
        return "请求失败主泵", "请求失败副泵"
